<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE html>
<html>
    <head>
        <title>EVA MOVIL</title>
        <link rel="stylesheet" href="http://code.jquery.com/mobile/1.0.1/jquery.mobile-1.0.1.min.css" />
        <link rel="stylesheet" href="../css/style.css" />
        <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script>
        <script src="http://code.jquery.com/mobile/1.0.1/jquery.mobile-1.0.1.min.js"></script>
        <script src="../scripts/utpljs.js"></script>  
    </head>
    <body>
        <?php
            global $USER, $CFG, $COURSE;
            require_once('../../config.php');
             require_once('../lib/lib.php');
            $curso = $_POST['courseid'];
            $oper = $_POST['oper'];
            //$curso = 35742;
            
            if( !empty ($curso) ){
                
                $COURSE = get_record("course", "id",$curso);
                if(! $COURSE){
                    echo "<h1>Curso desconocido<h1>";
                }
            }
             
            ////data-title="<?php echo "$COURSE->fullname";"
            //data-add-back-btn="true"
       //if( !empty( $curso ) && $oper == "get_curso"){
        ?>
        
        <div data-role="page" id="menucourse"  >

                <div data-theme="b" data-role="header">
                   <a href="#courselist" rel="external" class="muro" data-role="button" data-icon="arrow-l" data-transition="fade" data-iconpos="notext">Home</a>         
                        <h1><?php echo $COURSE->fullname; ?></h1>
                   <a href="login.php" class="salir" data-role="button" data-icon="delete" data-transition="fade" data-iconpos="notext">Salir</a>               
                </div><!-- /header -->

                <div data-role="content">
                         <?php 
                            $teachers= get_teachers($curso);
                            
                            foreach($teachers as $teacher){
                                $profeid = $teacher->id;
                                $datos_nm .= "<h3>".$teacher["name"]."</h3>";
                            }
                            $anuncios = get_records_sql("SELECT 
                                                                cs.id,  cs.summary,l.time            
                                                            FROM 
                                                                {$CFG->prefix}course_sections as cs, {$CFG->prefix}log as l  
                                                            WHERE 
                                                                cs.visible = 1 and cs.course = $COURSE->id
                                                                and cs.summary <> '' 
                                                                and cs.course = l.course 
                                                                and l.action = 'editsection'  and cs.section = l.info order by (cs.id) DESC");
                         ?>
                       <ul data-role="listview" data-inset="true" data-count-theme="e">                             
                             <li data-role="list-divider"><?php echo $COURSE->fullname; ?></p></li>
                             <div class="ui-grid-a">
                                    <div style="width: 15%" class="ui-block-a">
                                        <img src="<?php echo $CFG->wwwroot; ?>/user/pix.php?file=<?php echo $profeid;  ?>/f1.jpg"  alt="Usuario picture"/>
                                    </div>
                                    <div style="width: 75%" class="ui-block-b">
                                        <strong>Facilitador(es):</strong>
                                        <h2><?php echo $datos_nm; ?></h2>
                                    </div>
                            </div><!-- /grid-a class="link_interno" id="pag_anuncios" -->
                            
                             <li><a data-transition="slide"   href="#anuncioss"><img height="25px" width="25px" src="../imgs/anuncio.png" alt="Anuncio" class="ui-li-icon">Anuncios<span class="ui-li-count"><?php echo count($anuncios) ?></a></li> 
                             <li><a data-transition="slide"  href="#tareas"><img height="25px" width="25px" src="../imgs/tareas.png" alt="Tareas" class="ui-li-icon">  Tareas<span class="ui-li-count"><?php echo count( get_tareas($curso) ); ?></span></a></li> 
                             <li><a data-transition="slide"  href="#foros"><img height="25px" width="25px" src="../imgs/forum.png" alt="Foros" class="ui-li-icon">Foros<span class="ui-li-count"><?php echo count( get_foros($curso) ); ?></span></a>
                             </li>
                        </ul>
                        
                </div><!-- /content -->

                <div data-theme="b" data-role="footer">
                       <h5>
                         <img src="../imgs/logo2.png" whith="50px" height="40px"   alt="logo utpl"/>
                       </h5>
                </div><!-- /footer -->
        </div><!-- /page -->
        
        
        <?php
       /*} 
       
       if(!empty( $curso ) && $oper == "get_anucnios"){*/
        ?>
        
        <div data-role="page" id="anuncios" data-title="Anuncios"  >

                <div data-theme="b" data-role="header">
                   <a href="#menucourse" class="muro" data-role="button" data-icon="arrow-l" data-transition="fade" data-iconpos="notext">Home</a>              
                        <h1><?php echo "$COURSE->fullname";  ?></h1>
                   <a href="../login.php" class="salir" data-role="button" data-icon="delete" data-transition="fade" data-iconpos="notext">Salir</a>               
                </div><!-- /header -->

                <div data-role="content">
                        
                       <?php
                                $anuncios = get_records_sql("SELECT 
                                                                cs.id,  cs.summary,l.time            
                                                            FROM 
                                                                {$CFG->prefix}course_sections as cs, {$CFG->prefix}log as l  
                                                            WHERE 
                                                                cs.visible = 1 and cs.course = $COURSE->id
                                                                and cs.summary <> '' 
                                                                and cs.course = l.course 
                                                                and l.action = 'editsection'  and cs.section = l.info order by (cs.id) DESC");
                                if($anuncios){    
                                    echo '<ul data-role="listview">';
                                    foreach( $anuncios as $anuncio){                                                        

                                        echo '<li>
                                                            <p class="ui-li-aside"><strong>'. get_fecha($anuncio->time).'<strong></p><br>
                                                            <h3>'. utf8_encode($anuncio->summary).'</h3>
                                                            <br>
                                                            <!--<div class="ui-grid-b">
                                                                    <div class="ui-block-a"></div>
                                                                    <div class="ui-block-b"></div>
                                                                    <div class="ui-block-c"><a class="ui-li-aside" href="#"><img src="../imgs/comments-icon.png"  alt="comentarios"></a></div>
                                                            </div>-->
                                                            '. get_comentarios_rsa($COURSE->id, $anuncio->id).'
                                                      </li>';
                                    }//    
                                       echo  '</ul> ';//<a href="#" id="exit" data-theme="e" data-role="button" data-icon="gear" data-transition="fade" data-inline="true">Modificar</a><br>
                                    //<div class="red-soc"><a href="#"><img src="../imgs/comments-icon.png"  alt="comentarios"></a></div>
                                }else{
                                    echo "<h1>No Existen Anuncios<h1>";
                                }
                        ?>
                        
                </div><!-- /content -->

                <div data-theme="b" data-role="footer">
                       <h5>
                         <img src="../imgs/logo2.png" whith="50px" height="40px"   alt="logo utpl"/>
                       </h5>
                </div><!-- /footer -->
        </div><!-- /page -->
        
         <?php
         /*}
          if(!empty( $curso ) && $oper == "get_tareas"){*/
        ?>
        
        <div data-role="page" id="tareas" data-title="Tareas"  >

                <div data-theme="b" data-role="header">
                   <a href="#menucourse" class="muro" data-role="button" data-icon="arrow-l" data-transition="fade" data-iconpos="notext">Home</a>               
                        <h1><?php echo "$USER->firstname $USER->lastname ";  ?></h1>
                   <a href="login.php" class="salir" data-role="button" data-icon="delete" data-transition="fade" data-iconpos="notext">Salir</a>               
                </div><!-- /header -->

                <div data-role="content">
                         
                       mastareas
                        
                </div><!-- /content -->

                <div data-theme="b" data-role="footer">
                       <h5>
                         <img src="../imgs/logo2.png" whith="50px" height="40px"   alt="logo utpl"/>
                       </h5>
                </div><!-- /footer -->
        </div><!-- /page -->
        
        
         <?php
          /*}
           if(!empty( $curso ) && $oper == "get_foros"){*/
        ?>
        
        
        <div data-role="page" id="foros" data-title="Foros" >

                <div data-theme="b" data-role="header">
                   <a href="#menucourse" class="muro" data-role="button" data-icon="arrow-l" data-transition="fade" data-iconpos="notext">Home</a>               
                        <h1><?php echo "$USER->firstname $USER->lastname ";  ?></h1>
                   <a href="login.php" class="salir" data-role="button" data-icon="delete" data-transition="fade" data-iconpos="notext">Salir</a>               
                </div><!-- /header -->

                <div data-role="content">
                         
                      <?php echo "foros"; ?>
                        
                </div><!-- /content -->

                <div data-theme="b" data-role="footer">
                       <h5>
                         <img src="../imgs/logo2.png" whith="50px" height="40px"   alt="logo utpl"/>
                       </h5>
                </div><!-- /footer -->
        </div><!-- /page -->
        
        <?php 
          // }
        ?>
        
    </body>
</html>
